package at.mri.dogwatch.client.pages.widgets.videoeditor;

import at.mri.dogwatch.shared.proxy.VideoProxy;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.Editor;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class VideoEditor extends Composite implements Editor<VideoProxy> {

	@UiField TextBox titleEditor;
	@UiField TextBox youtubeTagEditor;
	@UiField TextArea descriptionEditor;
	@UiField TextBox tagsEditor;
	@UiField Button postButton;
	
	private static VideoEditorUiBinder uiBinder = GWT
			.create(VideoEditorUiBinder.class);

	interface VideoEditorUiBinder extends UiBinder<Widget, VideoEditor> {
	}
	

	public VideoEditor() {
		initWidget(uiBinder.createAndBindUi(this));
	}
	
	public HasClickHandlers getPostButton(){
		return postButton;
	}

	public void enable() {
		enable(true);
	}

	private void enable(boolean enabled) {
		titleEditor.setEnabled(enabled);
		youtubeTagEditor.setEnabled(enabled);
		descriptionEditor.setEnabled(enabled);
		tagsEditor.setEnabled(enabled);
		postButton.setEnabled(enabled);
	}

	public void disable() {
		enable(false);
	}

}
